package com.example.jasonrpc.example;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

public class CalcServiceImpl extends UnicastRemoteObject implements CalcService {
    protected CalcServiceImpl() throws RemoteException {
        super();
    }

    @Override
    public int add(int a, int b) throws RemoteException {
        if (a == 2) {
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        return a + b;
    }

    @Override
    public int substract(int a, int b) throws RemoteException {
        return a - b;
    }
}
